<template>
    <view class="ddinfo">
        <view class="formbd">
            <view class="flex-row flex-y-center sjname">
                <image :src="odinfo.store.logo"></image>
                <view class="flex-grow-1">{{ odinfo.table.type_name }}{{ odinfo.table.name }}({{ odinfo.order.tableware }}人)</view>
                <view class="flex-grow-0 flex-col flex-y-center kttext">
                    <view>流水号：{{ odinfo.order.order_num }}</view>
                    <view>开台时间：{{ odinfo.order.time }}</view>
                </view>
            </view>
            <view class="cart-item flex-row flex-y-center" v-for="(item, index) in odinfo.good" :key="index">
                <view class="xzhiding" v-if="item.is_jc == '1'">加菜</view>

                <view class="flex-grow-0 flex-y-center">
                    <image class="goods-pic" mode="aspectFill" :src="item.img"></image>
                </view>

                <view class="flex-grow-1 flex-col">
                    <view class="flex-grow-1">
                        <view class="goods-name">{{ item.name }}</view>
                        <view class="attr-list">
                            <view class="attr-item">{{ item.spec }}</view>
                        </view>
                    </view>
                    <view class="flex-grow-0 flex-row">
                        <view class="flex-grow-1 num">×{{ item.number }}</view>
                        <view class="flex-grow-0 price">￥{{ item.money }}/份</view>
                    </view>
                </view>
            </view>
            <view class="formftyh">
                <view class="formbdyh flex-row flex-y-center" v-if="odinfo.order.zk_money != '0.00'">
                    <view class="flex-row flex-y-center flex-grow-1">
                        <view class="yhhead te">折</view>
                        <view>会员折扣</view>
                    </view>
                    <view class="flex-grow-0">-￥{{ odinfo.order.zk_money }}</view>
                </view>
                <view class="formbdyh flex-row flex-y-center">
                    <view class="flex-row flex-y-center flex-grow-1">
                        <view class="yhhead jian">减</view>
                        <view>在线支付满减</view>
                    </view>
                    <view class="flex-grow-0">-￥{{ odinfo.order.mj_money }}</view>
                </view>
                <view class="formbdyh flex-row flex-y-center" v-if="odinfo.order.xyh_money != '0.00'">
                    <view class="flex-row flex-y-center flex-grow-1">
                        <view class="yhhead xin">新</view>
                        <view>新客户下单立减</view>
                    </view>
                    <view class="flex-grow-0">-￥{{ odinfo.order.xyh_money }}</view>
                </view>
                <view class="weui-cells weui-cells_after-title" style="border-top: 1rpx solid #f4f4f4; font-size: 11pt" v-if="odinfo.order.yhq_money != '0.00'">
                    <navigator class="weui-cell weui-cell_access" hoverClass="weui-cell_active">
                        <view class="weui-cell__hd">
                            <image
                                mode="aspectFit"
                                src="https://ymqycc.oss-cn-chengdu.aliyuncs.com/ymqzho2o/static/ymq_canyino2o/pages/img/personal/youhuiquan.png"
                                style="margin-right: 15rpx; vertical-align: middle; width: 40rpx; height: 40rpx"
                            ></image>
                        </view>
                        <view class="weui-cell__bd">商家优惠券</view>
                        <view class="">-￥{{ odinfo.order.yhq_money }}</view>
                    </navigator>
                </view>
                <view class="weui-cells weui-cells_after-title" style="border-top: 1rpx solid #f4f4f4; font-size: 11pt" v-if="odinfo.order.yhq_money2 != '0.00'">
                    <navigator class="weui-cell weui-cell_access" hoverClass="weui-cell_active">
                        <view class="weui-cell__hd">
                            <image
                                mode="aspectFit"
                                src="https://ymqycc.oss-cn-chengdu.aliyuncs.com/ymqzho2o/static/ymq_canyino2o/pages/img/hb.png"
                                style="margin-right: 15rpx; vertical-align: middle; width: 40rpx; height: 40rpx"
                            ></image>
                        </view>
                        <view class="weui-cell__bd">红包</view>
                        <view class="">-￥{{ odinfo.order.yhq_money2 }}</view>
                    </navigator>
                </view>
                <view class="sfk flex-row flex-y-center">
                    <view class="sfk-fv flex-grow-0">实付款</view>
                    <view class="flex-grow-1 xiaoji">
                        <view>已优惠￥{{ odinfo.order.discount }}</view>
                        <view>小计</view>
                        <view>￥{{ odinfo.order.money }}</view>
                    </view>
                </view>
            </view>
            <view class="formft">
                <view class="weui-cells weui-cells_after-title">
                    <view class="weui-cell weui-cell_access" hoverClass="weui-cell_active" v-if="odinfo.order.note != ''">
                        <view class="weui-cell__bd" style="min-width: 120rpx">备注</view>
                        <view class="weui-cell__ft">{{ odinfo.order.note }}</view>
                    </view>
                </view>
            </view>
            <view class="formft" v-if="odinfo.order.type == '1'">
                <view class="weui-cells__title headtitle">配送信息</view>
                <view class="weui-cells weui-cells_after-title">
                    <view class="weui-cell" v-if="odinfo.order.order_type == '1'">
                        <view class="weui-cell__bd">配送时间</view>
                        <view class="weui-cell__ft">{{ odinfo.order.delivery_time }}</view>
                    </view>
                    <view class="weui-cell" v-if="odinfo.order.order_type == '2'">
                        <view class="weui-cell__bd">买家自提</view>
                        <view class="weui-cell__ft">自提时间：{{ odinfo.order.delivery_time }}</view>
                    </view>
                    <view class="weui-cell" v-if="odinfo.order.order_type == '1'">
                        <view class="weui-cell__bd">收货地址</view>
                        <view class="weui-cell__ft">{{ odinfo.order.address }}</view>
                    </view>
                    <view class="weui-cell">
                        <view class="weui-cell__bd">联系方式</view>
                        <view class="weui-cell__ft">
                            {{ odinfo.order.name }}
                            <text v-if="odinfo.order.sex == '1'">(先生)</text>
                            <text v-if="odinfo.order.sex == '2'">(女士)</text>
                            {{ odinfo.order.tel }}
                        </view>
                    </view>
                    <view class="weui-cell" v-if="odinfo.order.order_type == '1'">
                        <view class="weui-cell__bd">配送方式</view>
                        <view class="weui-cell__ft">{{ odinfo.storeset.ps_mode }}</view>
                    </view>
                </view>
            </view>
            <view class="formft">
                <view class="weui-cells__title headtitle">订单详情</view>
                <view class="weui-cells weui-cells_after-title">
                    <view class="weui-cell">
                        <view class="weui-cell__bd">订单号</view>
                        <view class="weui-cell__ft">
                            {{ odinfo.order.order_num }}
                            <text @tap="copyText" class="copy" :data-text="odinfo.order.order_num">复制</text>
                        </view>
                    </view>
                    <view class="weui-cell">
                        <view class="weui-cell__bd">支付方式</view>
                        <view class="weui-cell__ft" v-if="odinfo.order.pay_type == '1'">微信支付</view>
                        <view class="weui-cell__ft" v-if="odinfo.order.pay_type == '2'">余额支付</view>
                        <view class="weui-cell__ft" v-if="odinfo.order.pay_type == '4'">货到付款</view>
                        <view class="weui-cell__ft" v-if="odinfo.order.pay_type == '5'">餐后支付</view>
                    </view>
                    <view class="weui-cell">
                        <view class="weui-cell__bd">下单时间</view>
                        <view class="weui-cell__ft">{{ odinfo.order.time }}</view>
                    </view>
                </view>
            </view>
            <view class="formft"></view>
        </view>
    </view>
</template>

<script>
import cardlist from '@/ymq_canyino2o/dist/cardlist/index';
import gettel from '@/ymq_canyino2o/dist/gettel/index';
var qqmapsdk;
var app = getApp();
var util = require('../../../utils/util.js');
var QQMapWX = require('../../../utils/qqmap-wx-jssdk.js');
export default {
    components: {
        cardlist,
        gettel
    },
    data() {
        return {
            color: '#34aaff',

            odinfo: {
                store: {
                    logo: ''
                },

                table: {
                    type_name: '',
                    name: ''
                },

                order: {
                    tableware: '',
                    order_num: '',
                    time: '',
                    zk_money: '',
                    mj_money: '',
                    xyh_money: '',
                    yhq_money: '',
                    yhq_money2: '',
                    discount: '',
                    money: '',
                    note: '',
                    type: '',
                    order_type: '',
                    delivery_time: '',
                    address: '',
                    sex: '',
                    pay_type: ''
                },

                good: [],

                storeset: {
                    ps_mode: ''
                }
            }
        };
    },
    onLoad: function (t) {
        app.globalData.setNavigationBarColor(this);
        console.log(t);
        var that = this;
        app.globalData.util.request({
            url: 'entry/wxapp/OrderInfo',
            cachetime: '0',
            data: {
                order_id: t.oid
            },
            success: function (t) {
                console.log(t.data);
                that.setData({
                    odinfo: t.data
                });
            }
        });
    },
    onReady: function () {},
    onShow: function () {},
    onHide: function () {},
    onUnload: function () {},
    onPullDownRefresh: function () {},
    onReachBottom: function () {},
    onShareAppMessage: function () {},
    methods: {
        maketel: function (t) {
            var o = t.currentTarget.dataset.tel;
            uni.makePhoneCall({
                phoneNumber: o
            });
        },

        copyText: function (t) {
            var o = t.currentTarget.dataset.text;
            uni.setClipboardData({
                data: o,
                success: function () {
                    uni.showToast({
                        title: '已复制'
                    });
                }
            });
        },

        location: function () {
            var t = this.odinfo.store.coordinates.split(',');
            var o = this.odinfo.store;
            console.log(t);
            uni.openLocation({
                latitude: parseFloat(t[0]),
                longitude: parseFloat(t[1]),
                address: o.address,
                name: o.name
            });
        }
    }
};
</script>
<style>
@import './dnddxq.css';
</style>
